package com.lfk.demo.Ability;


import com.lfk.justwetools.Utils.Log;
import com.lfk.justwetools.Component.MarkDown.MarkDownView;
import com.lfk.demo.ResourceTable;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.utils.net.Uri;

import java.io.File;

public class MarkDownAbility extends Ability {

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        setPattern(ResourceTable.Pattern_base);
        setUIContent(ResourceTable.Layout_ability_mark_down);
        MarkDownView markDownView = (MarkDownView)findComponentById(ResourceTable.Id_markdownview);
        if(getIntent().getStringParam("str") != null){
            markDownView.setStringSource(getIntent().getStringParam("str"));
        }
        File dir = null;
        Uri fileUri = getIntent().getUri();
        Log.i("fileUri:"+fileUri);
        if (fileUri != null) {
            dir = new File(fileUri.getDecodedPath());
        }

        if (dir != null) {
            markDownView.setDirSource(dir);
        }
    }

}
